<?php
error_reporting(0);
$isadmin=1;
include_once '../comm/config.php';
include '../comm/checkpostandget.php';
include_once 'include/page.class.php';
include 'check.php';
include_once('../comm/class_db.php');
if($_GET["del"]=="1"){
	$id=trim($_GET["id"]);
	delete_sql("shop", "id='".$id."'");
}
$keyword=$_GET['keyword']; 
$page = !($_GET['page'])?'1':intval($_GET['page']);
$pagesize=15;
$page2=($page-1)*$pagesize;
$total=count_sql("shop","*","(nick like '%".$keyword."%' or title like '%".$keyword."%') ");
$rs=sel_arr_sql("shop","*","(nick like '%".$keyword."%' or title like '%".$keyword."%' ) order by tuijian desc,addtime desc limit $page2,$pagesize");
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<script language="javascript" type="text/javascript"> 
function checkdel(str)
{
	if(confirm("确定删除吗？")==true){
		window.location.href="tao_dpgl.php?del=1&id="+str;
	}else{
		return false;
	}
}
</script>
</head>

<body>
<div id="main">
	<div id="topnav"><div class="titlebt">店铺管理</div></div>
	<div id="center">
	<form id="form1" name="form1" method="get" action="tao_dpgl.php">
		<table cellspacing="0" width="100%" height="25" style="border-top:1px  solid #DCEAF7; border-left:1px  solid #DCEAF7; border-right:1px  solid #DCEAF7;">
            <tr>
              <td height="25">&nbsp;<img src="images/search.gif" width="12" height="12" /> 关键字：
                    <input type="text" name="keyword" class="cinput" value="<?=$keyword?>" style="width:150px;" />
                    <input type="submit" name="Submit" value=" 查 找 " class="button" />
              </label>              [  <a href="tao_dpgl_add.php" class="link3">添加店铺</a> ]</td>
            </tr>
		</table>
		</form>
<table width="100%" border=1 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor="#DCEAF7">
                    <tr>
                      <td width="28%" height="27" bgcolor="#e9f2fb"><strong>&nbsp;店铺名称</strong></td>
                      <td width="15%" bgcolor="#e9f2fb"><strong>&nbsp;店铺掌柜</strong></td>
                      <td width="10%" align=center bgcolor="#e9f2fb"><strong>&nbsp;等级</strong></td>
					  <td width="7%" align=center bgcolor="#e9f2fb"><strong>&nbsp;返现比率</strong></td>
                      <td width="7%" align=center bgcolor="#e9f2fb"><strong>&nbsp;所在地</strong></td>
                      <td width="7%" align=center bgcolor="#e9f2fb"><strong>&nbsp;好评率</strong></td> 
					  <td width="7%" align=center bgcolor="#e9f2fb"><strong>&nbsp;排序</strong></td>                     
                      <td width="9%" align=center bgcolor="#e9f2fb"><strong>&nbsp;添加时间</strong></td>
                      <td width="10%" align="center" bgcolor="#e9f2fb"><strong>&nbsp;执行操作</strong></td>
                    </tr>
                    <?php
						foreach($rs as $row){
							echo "<tr>";
							echo "<td style='height:30px; '><div style='width:250px;overflow:hidden; margin-left:10px; height:30px; line-height:30px;'><a href=\"".$row["shop_click_url"]."\" target=\"_blank\">".$row["title"]."</a></div></td>";
							echo "<td height=30>&nbsp;<a href=\"".$row["shop_click_url"]."\" target=\"_blank\">".$row["nick"]."</a></td>";
							echo "<td align=center>&nbsp;<img src=\"../images/level_".$row["level"].".gif\"></td>";
							echo "<td align=center>&nbsp;".$row["fanxianlv"]."%</td>";
							echo "<td align=center>&nbsp;".$row["city"]."</td>";
							echo "<td align=center>&nbsp;".$row['good']."%</td>";
							echo "<td align=center>&nbsp;".$row["tuijian"]."</td>";						
							echo "<td align=center>&nbsp;".date("Y-m-d",$row["addtime"])."</td>";
							echo "<td align=center>&nbsp;<a href=tao_dpgl_add_step2.php?nick=".urlencode($row["nick"])." class=bluelink>修改</a> <a href=\"#dd\" onclick=\"checkdel('".$row["Id"]."')\" class=\"bluelink\">删除</a></td>";
							echo "</tr>";
						}
					?></table><div class="yahoo2" style=" margin-top:30px;"><?php 
				pageft($total,$pagesize,1,1,0,10,"tao_dpgl.php?keyword=$keyword");
				echo $pagenav;?></div>
                  </td>
                </tr>
              </table>
</div>
</div>
</body>
</html>
